import 'package:flutter/material.dart';
import 'package:flutter_getx/Locale/SR.dart';
import 'package:get/get.dart';

import 'logic.dart';
import 'state.dart';

class HomePageLocal extends StatefulWidget {
  const HomePageLocal({super.key});

  @override
  State<HomePageLocal> createState() => _HomePageState();
}

class _HomePageState extends State<HomePageLocal> {
  final HomeLogicLocal logic = Get.put(HomeLogicLocal());
  final HomeStateLocal state = Get.find<HomeLogicLocal>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('首页33')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            Obx(() => Text('姓名：${state.del.value}')),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () => {logic.add()},
              child: Text(SR.hello.tr),
            ),
          ],
        ),
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<HomeLogicLocal>();
    super.dispose();
  }
}
